package org.django4j;

import javax.servlet.http.HttpServletResponse;

/**
 * convert a model to xml string (castor?)
 */
public class Model{
    // viewType的定义与http的mimmetype是一致的
    public static final String TYPE_TEXT = "text/plain";
    public static final String TYPE_HTML = "text/html";
    public static final String TYPE_XML = "text/xml";    
    public static final String TYPE_JAVA = "application/x-java-serialized-object";
    public static final String TYPE_JSON = "text/json";    
    
    /** when mode is null, the http response body will be blank */ 
    private Object model = "<Return>OK</Return>";   
    private int statusCode = HttpServletResponse.SC_OK; // http status code
    private String viewType = TYPE_TEXT; //view type associated to model
    
    public Model(){}
    
    public Model(Object model){
        this.model = model;
    }
    
    public Model(Object model, int statusCode){
        this.model = model;
        this.statusCode = statusCode;
    }

    public Object getModel() {
        return model;
    }

    public void setModel(Object model) {
        this.model = model;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public String getViewType() {
        return viewType;
    }

    public void setViewType(String viewType) {
        this.viewType = viewType;
    }
    

}
